/*
 * @Author: xiawei 1243162387@qq.com
 * @Date: 2024-03-29 10:11:43
 * @LastEditors: xiawei 1243162387@qq.com
 * @LastEditTime: 2024-04-09 12:27:19
 */
import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';

import router from './router/index';
import pinia from './stores';
import './styles/index.scss';
import App from './App.vue';

async function enableMocking() {
  // @ts-ignore
  if (process.env.NODE_ENV !== 'development') {
    return
  }
  // @ts-ignore
  const { worker } = await import('../../../mocks/browser')
  return worker.start();
}

const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(ElementPlus);
enableMocking().then(() => {
  app.use(pinia);
  app.use(router);
  app.mount('#base-app');
})

